# 10. 找出作弊的人
const readline = require('readline');
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
});
let inputs = [];
rl.on('line', (input) => {
inputs.push(input);
});
rl.on('close', () => {
let n = parseInt(inputs.shift());
let arr = [];
for(let v of inputs) {
arr.push(v.split(' ').map(Number));
}
arr.sort((a,b)=> a[1] - b[1]);
let minDiff = Infinity;
let ans = [];
for(let i=0; i<arr.length-1; i++) {
let diff = arr[i+1][1] - arr[i][1];
if (diff < minDiff) {
minDiff = diff;
ans = [[arr[i][0], arr[i+1][0]]];
} else {
if (diff === minDiff) {
ans.push([arr[i][0], arr[i+1][0]]);
}
}
}
ans.sort((a,b)=>a[0]-b[0]);
for(let v of ans) {
console.log(v.join(' '));
}
})
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
← 9. 整数对最小和 11. 环中最长子串 →